import { fetch } from './fetch.js'
// 首页
export let ApiGetHomeData = () => fetch('/index/index', {}, {}, 'GET')
export let ApiGetUserData = (params) => fetch('/auth/loginByWeb', params, {}, "POST")
// goods
export let ApiGoods=(goods)=>fetch(`/goods/detail?id=${goods}`,{},{},"GET")

export let ApiGoodsRelat=(goods)=>fetch(`/goods/related?id=${goods}`,{},{},"GET")



//全部分类All
export let ApiallCategorized = () => fetch('/catalog/index', {}, {}, 'GET')
//专题
export let ApiZhuanTi = params => fetch(`/topic/list?page=${params.page}&size=${params.size}`, {}, {}, 'GET')

// 当前分类
export let ApiCurrent = params => fetch('/catalog/current', params, {}, 'GET')

// 品牌制造商详情
export let ApiBrandDetail = id => fetch('/brand/detail', { id }, {}, 'GET')

// 新品详情
export let ApiGoodsDatil = id => fetch('/goods/detail', { id }, {}, 'GET')

// 相关商品
export let ApiGoodsRelated = id => fetch('/goods/related', { id }, {}, 'GET')

// 搜索窗口数据
export let ApiGetSearchData=(search)=>fetch('/search/index',search,{'content-type':'application/X-Nideshop-Token'},"GET")

export let ApiGetClearhistoryData=(search)=>fetch('/search/clearhistory',search,{'content-type':'application/X-Nideshop-Token'},"POST")

// 购物车
export let ApiGetCart = () => fetch('/cart/index', {}, {}, "GET")

export let ApiGetUpdate = (params) => fetch('/cart/update', params, {"Content-Type": "application/json; charset=utf-8"}, "POST")

export let ApiGetChecked = (params) => fetch('/cart/checked', params, {}, "POST")

export let ApiGetDelete = (params) => fetch('/cart/delete', params, {}, "POST")